#include "feedbackdialog.h"
#include "ui_feedbackdialog.h"
#include <QMessageBox>

FeedbackDialog::FeedbackDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FeedbackDialog)
{
    ui->setupUi(this);
    setWindowTitle("意见反馈");
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    // 连接提交按钮的点击信号
    connect(ui->submitBtn, &QPushButton::clicked, this, &FeedbackDialog::onSubmitButtonClicked);
}

FeedbackDialog::~FeedbackDialog()
{
    delete ui;
}

void FeedbackDialog::onSubmitButtonClicked()
{
    QString feedback = ui->feedbackTextEdit->toPlainText();

    if (feedback.isEmpty()) {
        QMessageBox::warning(this, "警告", "请填写您的意见和建议！");
        return;
    }

    // 这里应该添加实际提交反馈的逻辑
    // 比如通过网络发送到服务器
    QMessageBox::information(this, "提示", "感谢您的反馈！我们会认真考虑您的建议。");
    accept(); // 关闭对话框并返回QDialog::Accepted
}